

#include <iostream>
using namespace std;

#include <vector>

void Test1()
{
	//vector<int> v(5, 1);
	//vector<int> v{ 1, 2, 3, 4, 5 };

	int a[] = { 1, 2, 3, 4, 5 };
	vector<int> v(a, a + sizeof(a) / sizeof(int));

	for (auto i : v)
	{
		cout << i << " ";
	}
	cout << endl;

	auto p = v.data();//int* p = v.data();
	//cout << typeid(p).name() << endl;

	for (int i = 0; i < v.size(); ++i)
	{
		cout << *(p + i) << " ";
	}
	cout << endl;

	//cout << *(p + v.size()) << endl;// err
	cout << v.at(v.size() - 1) << endl;
}

void show(vector<int>& v)
{
	for (auto i : v)
	{
		cout << i << " ";
	}
	cout << endl;

	cout << "size: " << v.size() << endl;
	cout << "capacity: " << v.capacity() << endl;
}

void Test2()
{
	vector<int> v{ 1, 2, 3, 4, 5 };
	vector<int> vv{ 3, 3, 3, 3, 3 };
	
	show(v);
	cout << endl;

	v.assign(20, 1);
	show(v);
	cout << endl;

	v.assign(vv.begin(), vv.end());
	show(v);
	cout << endl;
	show(vv);
	cout << endl;
} 

class Sln
{
public:
	vector<string> letterCombinations(string digits)
	{
		string s;
		int index = 0;
		vector<string> vs;

		if (digits.size())
		{
			_backtraking(digits, index, s);
		}


		return vs;
	}

private:
	vector<string> vs;
	static const vector<string> letters;

	//void _backtraking(const string& digits, int index, string s, vector<string>& vs)
	void _backtraking(const string& digits, int index, string s)
	{
		if (index == digits.size())
		{
			vs.push_back(s);
			return;
		}

		int digit = digits[index] - '0';
		string str = letters[digit];
		for (int i = 0; i < str.size(); ++i)
		{
			_backtraking(digits, index + 1, s + str[i]);
		}
	}
};

const vector<string> Sln::letters = { "", "", "abc", "def", "ghi", "jkl", "mno", "pqrs", "tuv", "wxyz" };

class A
{
private:
	vector<string> vs = {""};
};

int main()
{
	//Test1();
	//Test2();

	//Sln().letterCombinations(string("23"));

	A a;

	vector<int> v;

	return 0;
}